import java.io.*;
import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-10-06
 * Time: 21:27
 */
public class Test {
//    public static void main(String[] args) throws IOException {
//        File file = new File("test.txt");
//        File file1 = new File("test.zip");
//        file1.createNewFile();
////        System.out.println(file.getName());
////        System.out.println(file.getParent());
//        FileInputStream fileInputStream = new FileInputStream(file);
//        Scanner scanner = new Scanner(fileInputStream, "UTF-8");
//        while (scanner.hasNext()){
//            System.out.println(scanner.next());
//        }
//    }
    public static void main(String[] args) {
//        OutputStream output = new FileOutputStream("d:/test.txt");
//        OutputStreamWriter writer = new OutputStreamWriter(output, "utf8");
//        PrintWriter printWriter = new PrintWriter(writer);
//        printWriter.print("hello");
        try(OutputStream output = new FileOutputStream("d:/test.txt")) {
            try (OutputStreamWriter writer = new OutputStreamWriter(output, "utf8")){
                try (PrintWriter printWriter = new PrintWriter(writer)){
                    printWriter.print("hello");
                }
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } {

        }
    }
}
